#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2019/4/29 16:36
# @Author  : 何胜金-heshengjin
# @Site    : 
# @File    : enum_test.py
# @Software: PyCharm
"""
枚举的使用
"""

from enum import Enum, unique

# import enum

month1 = Enum("month", (
    'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November','December')
     )


# 推荐使用
@unique
class Month2(Enum):
    January = 'January'
    February = 'February'
    March = 'March'
    April = 'April'
    May = 'May'
    June = 'June'
    July = 'July'
    August = 'August'
    September = 'September '
    October = 'October'
    November = 'November'
    December = 'December'


if __name__ == '__main__':
    # 遍历
    for name, meber in month1._member_map_.items():
        print('key--------->', name, ';value--------->', meber, ';index---------->', meber.value)

    print("***************************************************************************************")

    print(Month2.January.name)
    print(Month2.January.value)
    print("***************************************************************************************")
    for name, meber in Month2._member_map_.items():
        print('key--------->', name, ';value--------->', meber, ';index---------->', meber.value)
